﻿using System;
using System.IO;
using System.Reflection;

namespace pmf
{
    internal sealed class SafeDirectory
    {
        static SafeDirectory _inst = new SafeDirectory();
        
        static SafeDirectory()
        { 
            //
        }

        public static SafeDirectory inst 
        { 
            get
            { 
                return _inst;
            }
        }

        SafeDirectory()
        {
            Directory.SetCurrentDirectory(getCurrent());
        }

        public string getCurrent()
        {
            return Path.GetDirectoryName(
                Assembly
                    .GetExecutingAssembly()
                    .GetModules()[0]
                    .FullyQualifiedName
            );
        }
    }
}
